package com.boarsoft.boar.config.lock.action;

import javax.annotation.Resource;

import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.boarsoft.bean.ReplyInfo;
import com.boarsoft.boar.config.service.CommonLockService;

@Component
@RestController
@RequestMapping("/lock")
public class LockConfigAction {
	@Resource
	CommonLockService commonLockService;
	@RequestMapping("/list.do")
	public ReplyInfo<Object> query(String appId, String url, String address, String type, String orderBy, int pageNo, int pageSize) {
		return commonLockService.list(appId, url, address, type, orderBy, pageNo, pageSize);
	}
	@RequestMapping("/lock.do")
	public ReplyInfo<Object> lock(String url, String appId, String type, String address) {
		return commonLockService.lock("-1",url,appId,type,address);
	}

	@RequestMapping("/unLock.do")
	public ReplyInfo<Object> unLock(String url, String appId, String type, String address) {
		return commonLockService.unLock("-1",url,appId,type,address);
	}

	@RequestMapping("/reduce.do")
	public ReplyInfo<Object> reduce(String url, String appId, String address, String oriType,String newType) {
		return commonLockService.reduce("-1",url,appId,address,oriType,newType);
	}
}